package org.openlab.webapp.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openlab.model.AppUser;
import org.openlab.service.AppUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/welcome")
public class WelcomController {
	private final Log log = LogFactory.getLog(getClass());
	@Autowired
	private AppUserService appUserService;
	
	@RequestMapping("/welcome")
	public ModelAndView main() {
		AppUser user = new AppUser();
		user.setUsername("admin");
		user.setEmail("admin@openlab.com");
		appUserService.save(user);
		return new ModelAndView("welcome", "message", "this is my message");
	}
}
